package org.atfeihu.springcloud.service.impl;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.atfeihu.springcloud.service.LianLuService;
import org.springframework.stereotype.Service;

/**
 * @author wangfeihu
 * @create 2021/9/12 10:05
 */
@Service
public class LianLuServiceImpl implements LianLuService {

    @Override
    @SentinelResource(value = "lianlu", blockHandler = "lianluHandler")
    public String lianlu() {
        return "流控模式(链路)";
    }

    public static String lianluHandler(BlockException blockException) {
        return "我是流控模式(链路)的异常处理, 您不符合sentinel中配置的流控模式(链路)！";
    }
}
